package com.lzzy.net.domain;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.*;
@Component    // 生成当前类的实例对象存到IOC容器中
@ConfigurationProperties(prefix = "person") // 将配置文件中以person开头的属性注入到该类中，可以批量注入属性值，属性名要保持一致
                                           // 将配置文件中的前缀为person的每个属性的值映射到当前类中是变量上，也就是把对应的值注入
public class Person {
    private int id;            //id
    private String name;      //姓名
    private List hobby;       //爱好
    private String[] family; //家庭成员
    private Map map;         //map集合
    private Pet pet;          //宠物 实体类型，需要创建实体类pet

    //以下生成get set方法

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getHobby() {
        return hobby;
    }

    public void setHobby(List hobby) {
        this.hobby = hobby;
    }

    public String[] getFamily() {
        return family;
    }

    public void setFamily(String[] family) {
        this.family = family;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    public Pet getPet() {
        return pet;
    }

    public void setPet(Pet pet) {
        this.pet = pet;
    }

    //以下生成一个toString
    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", hobby=" + hobby +
                ", family=" + Arrays.toString(family) +
                ", map=" + map +
                ", pet=" + pet +
                '}';
    }
}

